package com.bidepan.validation.two;

import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

//
// 通过validation注解实现数据校验
//

public class TestUser {
    @Test
    public void test1(){
        ApplicationContext context = new AnnotationConfigApplicationContext(ValidationConfig.class);
        Myvalidator1  myvalidator1 = context.getBean(Myvalidator1.class);
        User user1 = context.getBean("user1",User.class);
        System.out.println(user1.toString());
        boolean message = myvalidator1.validatorByUserOne(user1);
        System.out.println(message);
    }


    @Test
    public void test2(){
        ApplicationContext context = new AnnotationConfigApplicationContext(ValidationConfig.class);
        Myvalidator2  myvalidator2 = context.getBean(Myvalidator2.class);
        User user2 = context.getBean("user2",User.class);
        System.out.println(user2.toString());
        boolean message = myvalidator2.validatorByUsertwo(user2);
        System.out.println(message);
    }
}
